package cn.yj.wx.pay.config;

import cn.yj.common.monitor.WechatOrderMonitor;
import cn.yj.wx.pay.EnableWechatPayCondition;
import cn.yj.wx.pay.service.WechatPaySign;
import cn.yj.wx.pay.service.handler.AppPay;
import cn.yj.wx.pay.service.handler.H5Pay;
import cn.yj.wx.pay.service.handler.JSAPIPay;
import cn.yj.wx.pay.service.handler.NativePay;
import cn.yj.wx.pay.wrapper.WechatPayExecutor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;

/**
 * @author 永健
 * @since 2022-01-21 16:16
 */
@Conditional(value = EnableWechatPayCondition.class)
public class WechatPayAutoConfig {

    @Bean
    public WxPayConfig wxPayConfig() {
        return new WxPayConfig();
    }

    @Bean
    public WechatPayExecutor payExecutor() {
        return new WechatPayExecutor();
    }

    @Bean(name = "APP")
    public AppPay appPay() {
        return new AppPay();
    }

    @Bean(name = "H5")
    public H5Pay h5Pay() {
        return new H5Pay();
    }

    @Bean(name = "JSAPI")
    public JSAPIPay jsapiPay() {
        return new JSAPIPay();
    }

    @Bean(name = "NATIVE")
    public NativePay nativePay() {
        return new NativePay();
    }

    @Bean
    public WechatPaySign wechatPaySign() {
        return new WechatPaySign();
    }


    @Bean
    public WechatOrderMonitor wechatOrderMonitor(){
        return new WechatOrderMonitor();
    }
}
